<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib prefix="d" uri="http://dgg.net/jsp/jstl/core" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

    <meta charset="UTF-8">
    <title>退废单审核--顶呱呱IBOSS系统</title>
<div class="body-main">
    <table class="add-table form-table">
        <tbody>
        <tr>
            <th>所属订单：</th>
            <td>${map.scProductOrder.scProductOrderNo}</td>
        </tr>
        <tr>
            <th>客户名称：</th>
            <td>${map.scProductOrder.customerName}</td>
        </tr>
        <tr>
            <th>签单商务：</th>
            <td>${map.scProductOrder.signUserName}</td>
        </tr>
        <tr>
            <th>来源事业部：</th>
            <td>${map.scProductOrder.signUserOrgName}</td>
        </tr>
        <tr>
            <th>签单产品：</th>
            <td>${map.scProductOrder.productName}</td>
        </tr>
        <tr>
            <th>当前产品生产阶段：</th>
            <td>${map.scProductOrder.latestEndNodeName}</td>
        </tr>
        <tr>
            <th>退单原因：</th>
            <td>${map.scProductOrder.abandonReason}</td>
        </tr>
        <tr>
            <th>退单备注：</th>
            <td>${map.flowOperating.remarks}</td>
        </tr>
        </tbody>
    </table>
    <div class="line"></div>
    <div class="poerate-box">
        <div class="form-label">
            <label class="required">审核结果：</label>
        </div>
        <div class="layui-inline">
            <select class="select-style " onclick="isShow()" name="type" id="type">
                <option value="1">同意</option>
                <option value="2">不同意</option>
            </select>

        </div>
    </div>
    <div id="signinId">
        <c:if test="${scProductNodeFlow*1 >  (map.scProductOrder.abandonReasonNum + 1)}">
        <div class="poerate-box">
            <div class="layui-inline">
                <label class="required" style="margin-left: 58px">下一审核人：</label>
                <div class="layui-input-inline select2-inline">
                    <select class="select-style" id="nextAuditorId" name="nextAuditorId" auditorUser-select-law>
                        <option value>请选择</option>
                    </select>
                </div>
            </div>
        </div>
         </c:if>
    </div>
    <div class="poerate-box">
        <div class="form-label">
            <label>备注：</label>
        </div>
        <div class="layui-inline">
                         <textarea class="textarea-style " placeholder="备注不超过500字" name="remark" id="remark" rows="4"
                                   maxlength="500"></textarea>
        </div>
    </div>
    <div class="line"></div>
</div>
<script type="text/javascript"
        src="${basePath}/static/js/zzsc/production/sc_auditorUser.js?v=${version}"></script>
<script type="text/javascript"
        src="${basePath}/static/js/main-tabs.js?v=${version}"></script>
<script type="text/javascript">
    function auditOrderUpdate(id) {
        // debugger;
        var examineGrade = ${scProductNodeFlow};
        var abandonReasonNum = ${map.scProductOrder.abandonReasonNum + 1};
        var remark = $('[name="remark"]').val();
        var type = $('[name="type"]').val();
        var auditorId = $('[name="nextAuditorId"]').val();
        if (type == 1) {
            if (examineGrade > abandonReasonNum) {
                if (auditorId == null || "" == auditorId) {
                    DGG.Warning("请选择下一审核人！");
                    return;
                }
            }
        }
        DGG.Confire("确认审核订单吗？", '审核订单', function () {
            DGG.loading();
            $.ajax({
                url: sysInfo.basePath + '/zzsc/audit/audit_or_chargeback_order.do',
                data: {id: id, type: type, auditorId: auditorId, remark: remark},
                type: "POST",
                dataType: "json",
                success: function (obj) {
                    DGG.loading('close');
                    if (obj.code != 0) {
                        if (obj.msg){
                            DGG.Errors(obj.msg);
                        } else {
                            DGG.Errors("系统异常,请联系管理员!");
                        }
                    } else {
                        DGG.Succeed('操作成功！');
                        setTimeout(function () {
                            layer.closeAll();
                        }, 1000);
                        dataTableReload();
                    }
                }
            });
        }, function () {

        });
    }

    function isShow() {
        var obj = document.getElementById("type");
        var company = obj.options[obj.selectedIndex].value;
        company == 2 ? $('#signinId').hide() : $('#signinId').show();
    }
</script>
